Skip to content

feat: Implement Proxy Groups for Better Organization#1018

Draft
Wikid82 wants to merge 21 commits into
developmentfrom
feature/proxy_groups
Draft

feat: Implement Proxy Groups for Better Organization#1018
Wikid82 wants to merge 21 commits into
developmentfrom
feature/proxy_groups

Conversation

@Wikid82
Copy link
Copy Markdown
Owner

@Wikid82 Wikid82 commented May 15, 2026

Summary

Adds proxy group management to Charon, allowing proxy hosts to be organized into named groups for easier administration.


Backend

  • models/proxy_group.go — New ProxyGroup GORM model with UUID primary key, name, description, and host associations
  • models/proxy_host.go — Added GroupID (nullable FK) and Group association fields
  • services/proxy_group_service.go — CRUD service: create, list, get, update, delete with validation
  • services/proxyhost_service.go — Extended GetProxyHosts to support optional group filtering via group_id query param
  • api/handlers/proxy_group_handler.go — REST handler for /api/v1/proxy-groups (CRUD + host listing per group)
  • api/routes/routes.go — Registered proxy group routes under /api/v1/proxy-groups

Frontend

  • api/proxyGroups.ts — TanStack Query API client for proxy group CRUD
  • api/proxyHosts.ts — Added group_id field and group filter support
  • components/ProxyGroupBadge.tsx — Badge component displaying assigned group name
  • components/ProxyGroupForm.tsx — Form component for group assignment with combobox
  • hooks/useProxyGroups.ts — TanStack Query hooks: useProxyGroups, useCreateProxyGroup, useUpdateProxyGroup, useDeleteProxyGroup
  • pages/ProxyHosts.tsx — Proxy group column added to table; inline group assignment UI
  • Locale filesproxyGroup.* translation keys added for de, en, es, fr, zh

Tests

  • Backend unit tests: proxy_group_handler_test.go, proxy_group_service_test.go, proxyhost_service_group_test.go
  • Frontend unit tests: proxyGroups.test.ts, ProxyGroupBadge.test.tsx, ProxyGroupForm.test.tsx
  • Updated ProxyHosts test suite (12 files) to account for new group column
  • E2E Playwright spec: tests/proxy-groups.spec.ts

Quality Gates

  • ESLint: 0 errors (1006 pre-existing warnings, unchanged)
  • Frontend patch coverage: 100% on changed lines
  • Backend patch coverage: 66.2% (non-blocking per policy; new service/handler paths covered)
  • Semgrep: 0 findings in changed files (36 pre-existing findings in unrelated test fixtures)
  • vitest.config.ts coverage thresholds updated to reflect expanded test surface

@Wikid82 Wikid82 self-assigned this May 15, 2026
@Wikid82 Wikid82 added enhancement New feature or request high Important feature, should be included beta Part of beta release backend Server-side code frontend UI/UX code feature New functionality database Database-related ui User interface go manual-testing labels May 15, 2026
@Wikid82 Wikid82 added this to Charon May 15, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Charon May 15, 2026
@Wikid82 Wikid82 moved this from Backlog to In Progress in Charon May 15, 2026
@github-advanced-security
Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

✅ Supply Chain Verification Results

PASSED

📦 SBOM Summary

  • Components: 1487

🔍 Vulnerability Scan

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 4
🟢 Low 2
Total 6

📎 Artifacts

  • SBOM (CycloneDX JSON) and Grype results available in workflow artifacts

Generated by Supply Chain Verification workflow • View Details

actions-user and others added 7 commits May 15, 2026 08:04
Add ProxyGroup model, service, and CRUD API handlers with full
test coverage for host grouping functionality.

- Add ProxyGroup model with UUID, name, description, color fields
- Add ProxyGroupID FK and ProxyGroup preload to ProxyHost
- Add ProxyGroupService with Create/List/GetByUUID/Update/Delete
- Add ProxyGroupHandler with GET/POST/PUT/DELETE routes
- Extend ProxyHostHandler to resolve proxy_group_id by UUID or uint
- AutoMigrate ProxyGroup before ProxyHost in routes.go
- Add 22 tests across service, handler, and preload integration

Closes #254
Add ProxyGroups API client with TanStack Query hooks
Add ProxyGroupBadge and ProxyGroupForm components
Integrate proxy group selection into ProxyHosts page
Add locale strings (de, en, es, fr, zh) for proxy group feature
Add frontend unit tests for API client, components, and hooks
Add E2E Playwright spec for proxy group management workflows
Update ProxyHosts tests to reflect proxy group column addition
Update vitest config for new component test coverage
Add proxy group column and assignment UI to ProxyHosts table
Update proxyHosts API client to include group_id field
Add proxy group locale keys for all supported languages (de, en, es, fr, zh)
Update ProxyHosts tests to cover proxy group column and filtering
Extend vitest config for expanded proxy hosts test coverage
Comment thread frontend/src/pages/__tests__/ProxyHosts-bulk-acl.test.tsx Fixed
Comment thread frontend/src/pages/__tests__/ProxyHosts-bulk-apply.test.tsx Fixed
Comment thread frontend/src/pages/__tests__/ProxyHosts-bulk-delete.test.tsx Fixed
Comment thread frontend/src/pages/__tests__/ProxyHosts.bulkApplyHeaders.test.tsx Fixed
actions-user and others added 8 commits May 16, 2026 02:05
…onitors

feat(crowdsec): implement logic to remove whitelist file when no entries exist
test(crowdsec): add tests for whitelist YAML file removal when entries are empty
fix(uptime): enhance indexing for UptimeHeartbeat fields
- Hosts can be dragged individually or in bulk (multi-select) into any group
  section or the ungrouped section, updating their group membership server-side
- Backend exposes a single PUT /proxy-hosts/bulk-update-group endpoint that
  updates all dragged hosts in one request and calls Caddy ApplyConfig once
  instead of N times, keeping Caddy config consistent and avoiding thundering
  herd
- Optimistic UI update rolls back on network failure so the list never shows
  stale state after a failed drag
- Screen reader users receive live announcements on drag start, drag over,
  drop, and cancel via @dnd-kit accessibility.announcements, satisfying
  WCAG 2.2 §4.1.3
- Toast notifications correctly show success (with i18next pluralization count
  matching dragged host count) or error (including full-failure case that was
  previously silent)
- Group name helper exposed in ProxyHosts for accessibility announcements
  alongside the existing host name helper
- All five locale files updated with DnD announcement and status strings
- New DnD hook, drop zone, drag handle, and bulk API encapsulated in separate
  files to keep ProxyHosts.tsx focused on layout and wiring
- 6 unit tests for BulkUpdateGroup handler; 5 unit tests for useProxyGroupDnD
  hook covering happy path, no-op same-group, rollback, partial success, and
  multi-select drag
- Backend patch coverage 90.5%, frontend patch coverage 95.6%, overall 92%
…eration tests

- Five vi.mock() calls added for useSecurityHeaders and useProxyGroups in the
  bulk-operation test files were missing trailing semicolons, causing CodeQL to
  flag them under the automatic-semicolon-insertion rule
- Every other vi.mock() statement in those files has an explicit semicolon, so
  the linter correctly flagged the inconsistency
- No test logic was changed; the fix is purely syntactic to satisfy static analysis
- The react-i18next mock was returning raw keys verbatim, causing tests that
  look for human-readable strings like "Create Group" to fail against the
  rendered key "proxyGroups.createGroup"
- Expanded the mock to return proper translated strings for all keys used by
  the component, including interpolated values for the color preset aria-label
- No component logic changed; this is a test-only correction
Adding the Group column in the proxy groups feature pushed total column
widths to 112%, causing the right side of each row to overflow and get
clipped. Redistributed width from Name, Domain, Forward, SSL, and
Features columns to bring the total back to 100%.
@Wikid82 Wikid82 moved this from In Progress to In Review in Charon May 18, 2026
…ps feature

- Add trailing semicolons to vi.mock() blocks in five proxy host test files to
  eliminate CodeQL js/automatic-semicolon-insertion alerts that would have
  flagged CI code scanning
- Replace broken i18n mock in ProxyGroupForm tests with a full translation map
  so all 11 tests pass; they were previously failing in CI due to missing
  colorPreset translation keys
- Correct proxy hosts table column widths that totalled 112%, causing the group
  column to overflow in the host list view; columns now sum to exactly 100%
- Add targeted tests for proxy group rendering paths in ProxyHosts that were
  uncovered by the feature addition, lifting frontend patch coverage above
  threshold
- Add tests for useProxyGroupDnD drag-and-drop hook covering the boundary and
  reorder paths introduced by the proxy groups feature
- Install @dnd-kit/core as a direct dependency required by the group rendering
  tests in the jsdom environment

All local patch coverage thresholds pass: Overall 90.2% (≥90%), Backend 90.2%
(≥85%), Frontend 90.4% (≥85%). Coverage artifacts are fresh and verified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Server-side code beta Part of beta release database Database-related enhancement New feature or request feature New functionality frontend UI/UX code go high Important feature, should be included manual-testing ui User interface

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants